You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

13 lines
476 B

import { getItemById } from "#server/service/collection";
import { getContextUser } from "#server/utils/context";
export default defineWrappedResponseHandler({ auth: "required" }, async (event) => {
const user = getContextUser(event)!;
const id = parseInt(event.context.params!.id);
if (isNaN(id)) return R.error("无效的 ID", null);
const item = await getItemById(id, user.id);
if (!item) return R.error("收藏不存在", null);
return R.success(item);
});